import { crtChannel } from "./crtChannel";

/**结束弹窗 */
const { ccclass, property } = cc._decorator;

@ccclass
export default class winTs extends cc.Component {

    @property(cc.Node)
    node_check: cc.Node = null;
    @property(cc.Node)
    node_video: cc.Node = null;
    @property(cc.Node)
    btn_toggle: cc.Node = null;

    // LIFE-CYCLE CALLBACKS:

    onLoad() {
        // this.node_check.on(cc.Node.EventType.TOUCH_END, () => {
        //     this.node_check.active = !this.node_check.active;
        //     this.node_video.active = !this.node_video.active;
        // }, this);
        //@ts-ignore
        window.__prv.doAction(3, ['ks3']);
    }

    // start () {

    // }
    protected onEnable(): void {
        //@ts-ignore
        window.__prv.doAction('过关页面的下一关', ['hw', this.node_video]);
        //@ts-ignore
        window.__prv.doAction(5, ['oppo', this.node_check, this.node_video]);
        //@ts-ignore
        window.__prv.doAction(1, ['ks1', this.node_check, this.node_video]);
        //@ts-ignore
        window.__prv.doAction(1, ['ks2', this.node_check, this.node_video, this.btn_toggle.getChildByName('lab')]);
        //@ts-ignore
        window.countWin++;
        //@ts-ignore
        if (window.countWin > 0 && window.countWin % 3 == 0) {
            //@ts-ignore
            //window.__prv.doAction(4, ['ks3', this.btn_toggle]);
            window.__prv.doAction(1, ['ks3', this.node_video]);

        } else {
            //@ts-ignore
            window.__prv.doAction(1, ['ks3', this.node_video]);

        }
        //@ts-ignore
        window.__prv.doAction(8, ['ks3', cc.find("content/agree/lab", this.node), this.node_video]);
        //@ts-ignore
        window.__prv.doAction(9, ['ks3', cc.find("content/agree/oppo_tick", this.node), cc.find("content/agree/oppo_select", this.node), this.node_video]);
        //@ts-ignore
        window.__prv.doAction("过关界面", ['ks5', cc.find("content/agree/oppo_tick", this.node), this.node_video]);
        //@ts-ignore
        window.__prv.doAction("不管成功还是失败", ['ks5', cc.find("content/agree/oppo_tick", this.node).parent, this.node_video]);

    }

    // update (dt) {}
}
